package com.chenwenxuan.sync.utils;

public class SyncFile {
	
	private Path path;
	private long lastModified;
	private long size;
	private boolean exists;
	private boolean isDir;
	
	private Object fileObject;
	
	public static SyncFile createStub(Path path) {
		return new SyncFile(path, 0, 0, null, false, false);
	}
	
	public SyncFile(Path path, long lastModified, long size, Object fileObject, boolean exists, boolean isDir) {
		super();
		this.path = path;
		this.lastModified = lastModified;
		this.size = size;
		this.fileObject = fileObject;
		this.exists = exists;
		this.isDir = isDir;
	}

	public Path getPath() {
		return path;
	}

	public void setPath(Path path) {
		this.path = path;
	}

	public long getLastModified() {
		return lastModified;
	}

	public void setLastModified(long lastModified) {
		this.lastModified = lastModified;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public Object getFileObject() {
		return fileObject;
	}

	public void setFileObject(Object fileObject) {
		this.fileObject = fileObject;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (exists ? 1231 : 1237);
		result = prime * result + ((fileObject == null) ? 0 : fileObject.hashCode());
		result = prime * result + (isDir ? 1231 : 1237);
		result = prime * result + (int) (lastModified ^ (lastModified >>> 32));
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		result = prime * result + (int) (size ^ (size >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SyncFile other = (SyncFile) obj;
		if (exists != other.exists)
			return false;
		if (fileObject == null) {
			if (other.fileObject != null)
				return false;
		} else if (!fileObject.equals(other.fileObject))
			return false;
		if (isDir != other.isDir)
			return false;
		if (lastModified != other.lastModified)
			return false;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;
		if (size != other.size)
			return false;
		return true;
	}

	public boolean isExists() {
		return exists;
	}

	public void setExists(boolean exists) {
		this.exists = exists;
	}

	public boolean isDir() {
		return isDir;
	}

	public void setDir(boolean isDir) {
		this.isDir = isDir;
	}
	
	

}
